/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef RUNTIME_KB_COMMON_UTILS_CONFIGURATION_UTILS_H_
#define RUNTIME_KB_COMMON_UTILS_CONFIGURATION_UTILS_H_

#include <mutex>
#include <string>

#include "aoe/runtime_kb/common/kb_status.h"
#include "aoe/runtime_kb/common/kb_common.h"

namespace RuntimeKb {
class Configuration {
 public:
  Configuration(const Configuration&) = delete;

  Configuration& operator=(const Configuration&) = delete;

  static Configuration& Instance();

  Status Initialize();

  std::string GetBuiltInBankPath() const;

  std::string GetTuneBankPath() const;

  std::string GetAscendHomePath() const;

  std::string GetHomePath() const;

  std::string GetAscendCachePath() const;

  std::string GetCannKbLibPath() const;

  void Finalize();

 private:
  Configuration() : is_init_(false), cann_kb_libpath_() {
  }
  ~Configuration(){};
  Status InitCannKbLibPath();
  Status InitEnvPath(const char* env, std::string& real_path) const;
  bool is_init_;
  std::string cann_kb_libpath_;
  std::string tune_bank_path_;
  std::string ascend_cache_path_;
  std::string home_path_;
  std::mutex mtx_;
};
}  // namespace RuntimeKb
#endif
